import java.util.Scanner;

public class Leap_year {
    public static void main(String[] args) {

        System.out.printf("请输入年月日\n");
        Scanner leap = new Scanner(System.in);
        int year = leap.nextInt();
        int day = leap.nextInt();
        int month = leap.nextInt();
        switch(month)
        {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                System.out.printf("31\n");
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                System.out.printf("30\n");
                break;
            case 2:
                if((year%4 == 0 && year%100!=0)||year%400==0)
                {
                    System.out.printf("28\n");
                }
                else
                {
                    System.out.printf("29\n");
                }
                break;
        }
    }
}
